﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;
using Microhard.Permission.Models;
using Microhard.Framework.MVCHelper;
using Microhard.Permission.Interface;
using Microsoft.Practices.Unity;
using Telerik.Web.Mvc.UI;
using System.Collections;
using FluentValidation.Mvc;
using Microhard.WebUI.Models;
using Microhard.Permission.MVCFilter;

namespace Microhard.WebUI.Areas.Admin.Controllers
{
    public class ResouceController : MicroHardBaseController<Resouce>
    {
        private IResouce _resource = null;

        [Dependency]
        public IResouce resouce
        {
            set
            {
               base._repository = _resource = value;
            }
        }

        [MVCFilterAtrForLogon()]
        [MVCFilterAtrForResourcePermission(OperationKeyName = "Index")]
        public ActionResult ResourceSelect(AttributeOfWindow aowModel)
        {
            int totalCount;
            var rtn = _resource.Query(new Resouce(), 0, 10, out totalCount);
            aowModel.Data = new GridModel()
            {
                Data = rtn,
                Total = totalCount
            };
            return View(aowModel);
        }

    }
}
